﻿using System;
// 传递交错数组（或者二维数组）作为参数:
namespace ArrayApplication
{
    class Program
    {
        public int GetArea(int[][] array)
        {
            int sum = 0;

            for (int j = 0; j < array.Length; j++)
            {
                foreach (int i in array[j])
                {
                    sum += i;
                }
            }
            return sum;
        }

        static void Main(string[] args)
        {
            int[][] array = new int[3][];
            array[0] = new int[] { 0, 1 };
            array[1] = new int[] { 2, 3, 4 };
            array[2] = new int[] { 5, 6, 7, 8 };
            Program pro = new Program();
            int sum = pro.GetArea(array); //函数名作为参数
            Console.WriteLine("{0}", sum);
            Console.ReadKey();
        }
    }
}